/**
 * @Author: Gosin
 * @Date: 2020/1/10 13:55
 */
package main

import (
    "fmt"
    _ "git.900sui.cn/kc/apiPay/routers"
    "git.900sui.cn/kc/base/common/plugins/jaeger"
    "git.900sui.cn/kc/base/utils"
    "git.900sui.cn/kc/kcgin"
    "git.900sui.cn/kc/kcgin/logs"
    "github.com/gin-gonic/gin"
    "log"
)

func main() {
    service := gin.Default()

    new(utils.KcLog).GetInstance(kcgin.AppConfig.String("log.path")).PrintLog("开启日志")

    logs.EnableFuncCallDepth(true)
    logs.SetLogFuncCallDepth(3)
    //启动链路追踪
    _, closer, err := jaeger.OpenJaeger()
    if err == nil && closer != nil {
       defer closer.Close()
       service.Use( jaeger.SpanMiddle() )
    }
    kcgin.Bind(service)

    if err := service.Run(fmt.Sprintf("%v:%v",kcgin.AppConfig.String("httphost"),kcgin.AppConfig.String("httpport"))); err != nil {
        log.Fatalf("server start field:%v", err)
    }
}